package menu.lt.pers.menu;

import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.widget.LinearLayout;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import menu.lt.pers.menu.Bean.RecipeBean;
import menu.lt.pers.menu.Bean.RecipeClassResultBean;
import menu.lt.pers.menu.Bean.UserBean;
import menu.lt.pers.menu.adapter.RecipeRecyclerViewAdapter;

import java.util.ArrayList;
import java.util.List;

public class CollectionActivity extends FragmentActivity {

    private RecyclerView recyclerView;
    private RecipeRecyclerViewAdapter adapter;
    private LinearLayoutManager recipeManager;
    private UserBean user;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_collectivity);
        initView();
        initData();
        updateView();
    }

    private void initView() {
        recyclerView = findViewById(R.id.recyclerView);
    }

    private void initData() {
        user = getIntent().getParcelableExtra("user");
        adapter = new RecipeRecyclerViewAdapter(CollectionActivity.this,user);
        recipeManager = new LinearLayoutManager(this);
        recipeManager.setOrientation(LinearLayout.VERTICAL);
        recipeManager.setSmoothScrollbarEnabled(false);
        recyclerView.setLayoutManager(recipeManager);
    }
    private void updateView() {
        recyclerView.setAdapter(adapter);
    }
}
